<?php 
session_start();
include 'operations/connection.php';
include "generallibraries/funcs.php";
require_once('calendar/classes/tc_calendar.php');
$_SESSION['action'] = "acc-setup-customer";

if(!isset($_REQUEST['page'])){
	$list["ac_customer.Email"]="ASC";
	$list["ac_customer.CustomerName"]="ASC";
	$list["ac_customer.Address"]="ASC";
	$list["ac_customer.Phone"]="ASC";
	$list["ac_customer.Fax"]="ASC";
	$list["ac_customer.CreatedDate"]="DESC";
	$str="ac_customer.CreatedDate";
	$_SESSION['accsortn']=$str;
	$_SESSION['accsort']=$list;
}else{
	$str=$_SESSION['accsortn'];
	$list=$_SESSION['accsort'];
}

if(array_key_exists("page",$_GET))
    $page  = $_GET['page'];
else
    $page = 1;
        
$sqlTax = generalFunctions::listTax($_SESSION['lang']);
$mangTax=mysql_query($sqlTax);
$hamsort=" ORDER BY ".$str." ".$list[$str]."";
$sqlCustomer = generalFunctions::listCustomer("ac_customer.CustomerID, ac_customer.CustomerName, ac_customer.Address, ac_customer.Phone, ac_customer.Fax,ac_customer.Email",$hamsort);
$mangCustomer=mysql_query($sqlCustomer);
$number_of_page = ceil ( mysql_num_rows( $mangCustomer ) / $rows_per_page ); 
$_SESSION['checksoluong']=mysql_num_rows( $mangCustomer );
$fromdate=date("Y-m-d");
if(isset($_REQUEST['rtype'])){
	$_REQUEST['rtype']=$_REQUEST['rtype'];
	$_REQUEST['vt']=$_REQUEST['rtype'];
}else{
	$_REQUEST['rtype']="Purchase";
}
if(isset($_REQUEST['abc'])){
	$_REQUEST['abc']=$_REQUEST['abc'];
	$_REQUEST['vta']=$_REQUEST['abc'];
}else{
	$_REQUEST['abc']="1";
}
$_SESSION['thucthi']="new";
?>
<link	href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(document).ready(function(){
	document.getElementById("txtcomname").focus();
});
function sort(page,str,co)
{
	var search=document.getElementById('searchname').value;
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("viewlistcustomer").innerHTML=xmlhttp.responseText;
										    	resetvalue();
										  }
									  }
	xmlhttp.open("GET","ajax/acc/sortcustomer.php?page="+page+"&str="+str+"&co="+co+"&searchname="+search,true);
	xmlhttp.send();
}

function resetcustomer(){
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("funcsearch").innerHTML=xmlhttp.responseText;
										    	resetvalue();
										  }
									  }
	xmlhttp.open("GET","ajax/acc/resetcustomer.php?",true);
	xmlhttp.send();
}

function changeSearch(str){
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("viewlistcustomer").innerHTML=xmlhttp.responseText;
										    	resetvalue();
										  }
									  }
	xmlhttp.open("GET","ajax/acc/changesearch.php?search="+str,true);
	xmlhttp.send();
}

function resetvalue(){
	/*document.getElementById("txtdes").value="";
	document.getElementById("txtmobile").value="";
	document.getElementById("txtphone").value="";
	document.getElementById("txtfax").value="";
	document.getElementById("txtcomname").value="";
	document.getElementById("txtaddress").value="";
	document.getElementById("txtwebsite").value="";
	document.getElementById("txtcomtype121").value="";
	document.getElementById("txtcomtype122").value="";
	document.getElementById("txtcontactperson").value="";
	document.getElementById("txtmail").value="";
	document.getElementById("txtcompanyname").value="";
	document.getElementById("txtcomnum").value="";*/
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("viewadd").innerHTML=xmlhttp.responseText;
										    	//resetvalue();
										    	document.getElementById("txtcomname").focus();
										  }
									  }
	xmlhttp.open("GET","resetaddcustomer.php",true);
	xmlhttp.send();
	
}

function resetvalue1(field){
	/*document.getElementById("txtdes").value="";
	document.getElementById("txtmobile").value="";
	document.getElementById("txtphone").value="";
	document.getElementById("txtfax").value="";
	document.getElementById("txtcomname").value="";
	document.getElementById("txtaddress").value="";
	document.getElementById("txtwebsite").value="";
	document.getElementById("txtcomtype121").value="";
	document.getElementById("txtcomtype122").value="";
	document.getElementById("txtcontactperson").value="";
	document.getElementById("txtmail").value="";
	document.getElementById("txtcompanyname").value="";
	document.getElementById("txtcomnum").value="";*/
	for(var i = 0;i<field.length;i++)
    {
		field[i].checked = false ;
    }
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function(){
										  if (xmlhttp.readyState==4 && xmlhttp.status==200){
										    	document.getElementById("viewadd").innerHTML=xmlhttp.responseText;
										    	//resetvalue();
										    	document.getElementById("txtcomname").focus();
										  }
									  }
	xmlhttp.open("GET","resetaddcustomer.php",true);
	xmlhttp.send();
	
}

function addnew(kt,checknamecus){
	if(kt=="new"){
		var comname=document.getElementById("txtcomname").value;
		if(comname==""){
			alert("<?php echo $l_companynamenotnull;?>");
		}else{
			alert(checknamecus);
			if(checknamecus=="ok"){
				var txtdes=document.getElementById("txtdes").value;
				var txtmobile=document.getElementById("txtmobile").value;
				var txtphone=document.getElementById("txtphone").value;
				var txtfax=document.getElementById("txtfax").value;
				var txtcomname=document.getElementById("txtcomname").value;
				var txtaddress=document.getElementById("txtaddress").value;
				var txtwebsite=document.getElementById("txtwebsite").value;
				var txtcomtype121=document.getElementById("txtcomtype121").value;
				var txtcomtype122=document.getElementById("txtcomtype122").value;
				var txtcontactperson=document.getElementById("txtcontactperson").value;
				var txtmail=document.getElementById("txtmail").value;
				var txtcomnum=document.getElementById("txtcomnum").value;

				var etax = document.getElementById("cbtax");
				var txttax = etax.options[etax.selectedIndex].value;
				var txttype =$('input[name=rtype]:checked').val();
				var txtactive =$('input[name=abc]:checked').val();
				var txttrandate = document.getElementById("trandate").value;

				if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
					xmlhttp=new XMLHttpRequest();
				}else{// code for IE6, IE5
					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				xmlhttp.onreadystatechange=function(){
													  if (xmlhttp.readyState==4 && xmlhttp.status==200){
													    	document.getElementById("funcsearch").innerHTML=xmlhttp.responseText;
													    	resetvalue();
													  }
												  }
				xmlhttp.open("POST","ajax/acc/acc-setup-addnewcustomer.php?proc=add&txttrandate="+txttrandate+"&txtactive="+txtactive+"&txttype="+txttype+"&txttax="+txttax+"&txtcomnum="+txtcomnum+"&txtmail="+txtmail+"&txtcontactperson="+txtcontactperson+"&txtcomtype122="+txtcomtype122+"&txtcomtype121="+txtcomtype121+"&txtwebsite="+txtwebsite+"&txtaddress="+txtaddress+"&txtcomname="+txtcomname+"&txtdes="+txtdes+"&txtmobile="+txtmobile+"&txtphone="+txtphone+"&txtfax="+txtfax,true);
				xmlhttp.send();
			}else{
				//document.getElementById("txtcomname").focus();
				alert(checknamecus);
				
				//document.getElementById("txtcomname").select();
				
			}
		}
	}
}

function update(kt,idcus,checknamecus){
	if(kt=="updel"){
		var comname=document.getElementById("txtcomname").value;
		if(comname==""){
			alert("<?php echo $l_companynamenotnull;?>");
		}else{
			if(checknamecus=="ok"){
				hoi= confirm("<?php echo $l_areyousure;?>");
				if(hoi==true){
					var txtdes=document.getElementById("txtdes").value;
					var txtmobile=document.getElementById("txtmobile").value;
					var txtphone=document.getElementById("txtphone").value;
					var txtfax=document.getElementById("txtfax").value;
					var txtcomname=document.getElementById("txtcomname").value;
					var txtaddress=document.getElementById("txtaddress").value;
					var txtwebsite=document.getElementById("txtwebsite").value;
					var txtcomtype121=document.getElementById("txtcomtype121").value;
					var txtcomtype122=document.getElementById("txtcomtype122").value;
					var txtcontactperson=document.getElementById("txtcontactperson").value;
					var txtmail=document.getElementById("txtmail").value;
					var txtcomnum=document.getElementById("txtcomnum").value;

					var etax = document.getElementById("cbtax");
					var txttax = etax.options[etax.selectedIndex].value;
					var txttype =$('input[name=rtype]:checked').val();
					var txtactive =$('input[name=abc]:checked').val();
					var txttrandate = document.getElementById("trandate").value;

					if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
						xmlhttp=new XMLHttpRequest();
					}else{// code for IE6, IE5
						xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					xmlhttp.onreadystatechange=function(){
														  if (xmlhttp.readyState==4 && xmlhttp.status==200){
														    	document.getElementById("funcsearch").innerHTML=xmlhttp.responseText;
														    	resetvalue();
														  }
													  }
					xmlhttp.open("POST","ajax/acc/acc-setup-addnewcustomer.php?idcus="+idcus+"&proc=update&txttrandate="+txttrandate+"&txtactive="+txtactive+"&txttype="+txttype+"&txttax="+txttax+"&txtcomnum="+txtcomnum+"&txtmail="+txtmail+"&txtcontactperson="+txtcontactperson+"&txtcomtype122="+txtcomtype122+"&txtcomtype121="+txtcomtype121+"&txtwebsite="+txtwebsite+"&txtaddress="+txtaddress+"&txtcomname="+txtcomname+"&txtdes="+txtdes+"&txtmobile="+txtmobile+"&txtphone="+txtphone+"&txtfax="+txtfax,true);
					xmlhttp.send();
				}
			}else{
				alert(checknamecus);
				//document.getElementById("txtcomname").focus();
				//document.getElementById("txtcomname").select();
			}
		}
	}
}

function deleteone(kt,st,idcus){
	if(kt=="updel"){
		if(st=="1"){
			alert("<?php echo $l_customeractivenotdelete;?>");
		}else{
			hoi= confirm("<?php echo $l_areyousure;?>");
			if(hoi==true){
				if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
					xmlhttp=new XMLHttpRequest();
				}else{// code for IE6, IE5
					xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				xmlhttp.onreadystatechange=function(){
													  if (xmlhttp.readyState==4 && xmlhttp.status==200){
													    	document.getElementById("funcsearch").innerHTML=xmlhttp.responseText;
													    	resetvalue();
													  }
												  }
				xmlhttp.open("GET","ajax/acc/acc-setup-addnewcustomer.php?idcus="+idcus+"&proc=delete",true);
				xmlhttp.send();
			}
		}
	}
}

function checkonly(tenid,field){
	if(document.getElementById(tenid).checked == true){
		for(var i = 0;i<field.length;i++)
	    {
			field[i].checked = false ;
	    }
		document.getElementById(tenid).checked = true;
	 	var gtid=document.getElementById(tenid).value;
	 	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
	 		xmlhttp=new XMLHttpRequest();
	 	}else{// code for IE6, IE5
	 		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	 	}
	 	xmlhttp.onreadystatechange=function(){
			 	if (xmlhttp.readyState==4 && xmlhttp.status==200){
			 		document.getElementById("viewadd").innerHTML=xmlhttp.responseText;
			 	}
		 	}
	 	xmlhttp.open("GET","onlycheckcustomer.php?idcus="+gtid,true);
	 	xmlhttp.send();
	}else{
		document.getElementById(tenid).checked=false;
		resetvalue();
	}
	
 }

function enterTable(e,value){
    var key = window.event ? e.keyCode : e.which;
    if(key==13){
		var j = 0;
		var listID = new Array();
		listID = listID.concat(["txtcomname","cbtax","txtaddress","txtwebsite","txtcomnum","txtcomtype121","txtcomtype122","rtype","txtcontactperson","txtmail","txtfax","txtphone","txtmobile","txtdes","abc"]);	
		for (j = 0; j < listID.length; j++){	
			if (listID[j] == value) {	
				if (j == listID.length - 1) {
					return false;
				}
				document.getElementById(listID[j + 1]).focus();
				document.getElementById(listID[j + 1]).select();
				return false; 
			}
		}
		
		return false;
	}else
		return true;	
				
}

function checkname(value){
	//alert("a: "+value);
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
 		xmlhttp=new XMLHttpRequest();
 	}else{// code for IE6, IE5
 		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
 	}
 	xmlhttp.onreadystatechange=function(){
		 	if (xmlhttp.readyState==4 && xmlhttp.status==200){
		 		document.getElementById("viewerr").innerHTML=xmlhttp.responseText;
		 	}
	 	}
 	xmlhttp.open("GET","ajax/acc/checknamecus.php?newname="+value,true);
 	xmlhttp.send();
}

function checkname1(value,idcus){
	//alert("a: "+value);
	if (window.XMLHttpRequest){// code for IE7+, Firefox, Chrome, Opera, Safari
 		xmlhttp=new XMLHttpRequest();
 	}else{// code for IE6, IE5
 		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
 	}
 	xmlhttp.onreadystatechange=function(){
		 	if (xmlhttp.readyState==4 && xmlhttp.status==200){
		 		document.getElementById("viewerr").innerHTML=xmlhttp.responseText;
		 	}
	 	}
 	xmlhttp.open("GET","ajax/acc/checknamecus.php?idcus="+idcus+"&newname="+value,true);
 	xmlhttp.send();
}
</script>
<div class="title"></div>
<form method="post" action="#"  name="accsetupcus">
<div class="content_code">
	<div class="approval-right">						
		<div id="funcsearch" style="border: 1px solid silver; border-radius: 7px 7px 7px 7px; padding-bottom: 10px; margin-bottom: 10px;">
			<input type="hidden" name="content" value="accountant-setup-customer-content" />
			<div style="margin: 10px 0px 5px 5px;">
				<table>
					<tr>
						<td style="vertical-align:middle"><?php echo $l_customername;?></td>
						<td id="txtsearch"><input onkeyup="changeSearch(this.value);" style="width:250px; autocomplete:off; " type="text" name="searchname" class="in_testfield" id="searchname"  value="<?=$_POST['searchname']?>"/></td>
						<td><input onclick="resetcustomer();" type="button" value="Reset" class="btnupbg btnupload" /></td>
					</tr>
				</table>
			</div>
			<div id="viewlistcustomer" style="width:100%">
			<!-- <input type="hidden" name="sl" id="sl" value="<?=mysql_num_rows($mangCustomer)?>" /> -->
			<table class="cssTable" width="100%">
				<thead>
					<tr>
						<th scope="col"></th>
						<th scope="col"><a onclick="sort(<?=$page?>,'ac_customer.CustomerName',1);" ><?php echo $l_customername;?></a></th>
						<th scope="col"><a onclick="sort(<?=$page?>,'ac_customer.Address',1);" ><?php echo $l_address;?></a></th>
						<th scope="col"><a onclick="sort(<?=$page?>,'ac_customer.Phone',1);" ><?php echo $l_phone;?></a></th>
						<th scope="col"><a onclick="sort(<?=$page?>,'ac_customer.Fax',1);" ><?php echo $l_Fax;?></a></th>
						<th scope="col"><a onclick="sort(<?=$page?>,'ac_customer.Email',1);" ><?php echo $l_email;?></a></th>
					</tr>
				</thead>
				<tbody>
					<?php 
						if(mysql_num_rows($mangCustomer)>0){
							$i=0;
							while($row = mysql_fetch_array($mangCustomer)){
								if ( $i >= $page_start ){
								?>
									<tr>
									<td><div style="text-align:center"><input onclick="checkonly(this.id,document.accsetupcus.list);" type="checkbox" name="list" id="<?php echo 'checkcus'.$i?>" value="<?=$row[CustomerID]?>"/></div></td>
									<td><?php echo $row[CustomerName];?></td>
									<td><?php echo $row[Address];?></td>
									<td><?php echo $row[Phone];?></td>
									<td><?php echo $row[Fax];?></td>
									<td><?php echo $row[Email];?></td>
									</tr>
								<?php 
								}
								$i++;
								if ($i >= $page_end){ 
									break; 
								}
							}								
						}
					?>
					<tr>
						<td colspan="6" class="bt_td_main">
							<span style="background:#fff; padding:1px; display: inline-block;">
														
								<?php if ( $number_of_page > 1 ) 
								{ 
									if ($page==1)
										$p=2;
									else if ($page==$number_of_page)
										$p=$number_of_page-1;
									else $p=$page;
									if($page!=1){?>
										<a onclick="sort(1,'<?=$str?>',0);" ><span class='button_next'><?php echo "<<<";?></span> </a>
										<a onclick="sort(<?=($page-1)?>,'<?=$str?>',0);" ><span class='button_next'><?php echo "<<";?></span> </a>
									<?php  }
									else{
										echo "<span class='button_next'><<<</span> "; 
										echo "<span class='button_next'><<</span> ";
									}
									for ( $i = $p-1; $i <= $p+1; $i++ ) {	
											if ($i<=$number_of_page && $i>0)
											
												if ($i==$page){
													echo "<span class='button_next'><b>".$i."</b></span>"; 
												}else{
												?>
													<a onclick="sort(<?=$i?>,'<?=$str?>',0);" ><span class="button_next">
													<?php 
													echo $i;
													?>
													</span> </a>
													<?php 
												}
											?>
										
									<?php 
											}
										
										if($page!=$number_of_page){ ?>
											<a onclick="sort(<?=($page+1)?>,'<?=$str?>',0);"><span class='button_next'><?php echo ">>";?></span> </a>
											<a onclick="sort(<?=($number_of_page)?>,'<?=$str?>',0);" ><span class='button_next'><?php echo ">>>";?></span> </a>
										<?php }
										else{
											echo "<span class='button_next'>>></span> ";
											echo "<span class='button_next'>>>></span> ";
										}
									}
								
									
									?>
																						
							</span>
						</td>
					</tr>
				</tbody>
			</table>
			</div>
		</div>
		<div style="border: 1px solid silver; border-radius: 7px 7px 7px 7px; padding-bottom: 10px; margin-bottom: 10px;" id="viewadd">
			<div class="head_info"><?php echo $l_customer;?></div>
			<div style="margin:5px 5px 10px 7px">
			<div style="text-align: left;font-size:12px;font-weight:bold" id="viewdate">
				<table>
					<tr>
						<td ><span><b><?php echo $l_Transactionregistrydate;?> :</b></span></td>
						<td style="padding-left:3px;">
							<?php
							  $myCalendar1 = new tc_calendar("trandate", true);
							  $myCalendar1->setIcon("calendar/images/iconCalendar.gif");
							  $d=split('-',$fromdate,3);
							 
							  $myCalendar1->setDate($d[2],$d[1],$d[0]);
							  $myCalendar1->setPath("calendar/");
							  $myCalendar1->setYearInterval(2010, 2015);
							  $myCalendar1->dateAllow('2010-01-01', '2015-12-31');
							  //$myCalendar1->setHeight(350);
							  //$myCalendar1->autoSubmit(true, "form1");
							  //$myCalendar1->setSpecificDate(array("2011-04-01", "2011-04-13", "2011-04-25"), 0, 'month');
							  $myCalendar1->setOnChange("myChanged('test')");
							  //$myCalendar->rtl = true;
							  $myCalendar1->writeScript();
		
							  //echo $myCalendar1->getDate();
							  
						  ?>
						</td>
					</tr>
				</table>
 			</div>
			<div style="margin: 10px 7px 5px 3px; color: #508E21; border-bottom: 1px dotted silver"> <?php echo $l_CompanyDetails;?> </div>
			<table style="border-bottom: 1px dotted silver; padding:10px 5px" width="100%">
                                  <tr>
                                    <td class="tdfirst"><?php echo $l_company_name;?>:</td>
                                    <td><input type="text" onkeypress="return enterTable(event,this.id);" onkeyup="checkname(this.value);" name="txtcomname" id="txtcomname" class="in_testfield" style="float:left" />
                                        <span style="background: #E8E8E8;float: left;margin-left: 3px;padding: 5px;width: 80px;"> <?php echo $l_tax;?> : </span>
	                                      <select id="cbtax" onkeypress="return enterTable(event,this.id);" name="cbtax" style="width:120px; height:22px; margin-left:3px">
	                                        <?php 
	                                        	if(mysql_num_rows($mangTax)>0){
	                                        		while($row= mysql_fetch_array($mangTax)){
	                                        			?>
	                                        			<option value="<?=$row[TaxID];?>"
	                                        				<?php 
	                                        					if($_REQUEST['cbtax']==$row[TaxID]){
	                                        						?>
	                                        						selected="selected"
	                                        						<?php 
	                                        					}
	                                        				?>
	                                        			><?php echo $row[TaxName];?></option>
	                                        			<?php 
	                                        		}
	                                        	}
	                                        ?>
	                                      </select>
                                      </td>
                                  </tr>
                                  <tr>
                                  	<td></td>
                                  	<td id="viewerr" style="color:red; font-weight: bold;"></td>
                                  </tr>
                                  <tr>
                                    <td class="tdfirst"><?php echo $l_address;?>:</td>
                                    <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtaddress" id="txtaddress" class="in_testfield" style="width:516px" /></td>
                                  </tr>
                                  <tr>
                                    <td class="tdfirst"><?php echo $l_Website;?>:</td>
                                    <td><input type="text" name="txtwebsite" onkeypress="return enterTable(event,this.id);" id="txtwebsite" class="in_testfield" style="width:516px" /><span style="font-size:11px; color:#424242; padding-left:10px">eg. http://www.elisoft.com, http://www.google.com</span> </td>
                                  </tr>
                                  <tr>
                                    <td class="tdfirst"><?php echo $l_CompanyNumber;?>:</td>
                                    <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtcomnum" id="txtcomnum" class="in_testfield" style="width:516px" /></td>
                                  </tr>
                                  <tr>
                                    <td class="tdfirst"><?php echo $l_Companytype12;?>:</td>
                                    <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtcomtype121" id="txtcomtype121" class="in_testfield" style="width:250px" />
                                      /
                                      <input style="width:250px" type="text" onkeypress="return enterTable(event,this.id);" name="txtcomtype122" id="txtcomtype122"  class="in_testfield" /></td>
                                  </tr>
                                  <tr>
                                    <td class="tdfirst"><?php echo $l_Companytype;?>:</td>
                                    <td>
                                      	<table width="80%">
                                      		<tr>
                                      			<td><input type="radio" id="rtype" onkeypress="return enterTable(event,this.id);" name="rtype"  value="Purchase" <?php if ($_REQUEST["rtype"]=="Purchase") echo "checked";?> /><?php echo $l_Buys;?></td>
                                      			<td><input type="radio" id="rtype" onkeypress="return enterTable(event,this.id);" name="rtype"  value="Sale" <?php if ($_REQUEST["rtype"]=="Sale") echo "checked";?> /><?php echo $l_Sales;?></td>
                                      			<td><input type="radio" id="rtype" onkeypress="return enterTable(event,this.id);" name="rtype"  value="CaHai" <?php if ($_REQUEST["rtype"]=="CaHai") echo "checked";?> /><?php echo $l_Buyandsale;?></td>
                                      			<td><input type="radio" id="rtype" onkeypress="return enterTable(event,this.id);" name="rtype"  value="CreditCard" <?php if ($_REQUEST["rtype"]=="CreditCard") echo "checked";?> /><?php echo $l_Creditcard;?></td>
                                      		</tr>
                                      	</table>
                                      </td>
                                  </tr>
                                </table>
								 <div style="margin: 10px 7px 5px 3px; color: #508E21; border-bottom: 1px dotted silver"> <?php echo $l_Contactperson;?> </div>
			<table style="border-bottom: 1px dotted silver; padding:10px 5px" width="100%">
                                 <tr>
                                    <td class="tdfirst"><?php echo $l_Contactperson;?>:</td>
                                    <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtcontactperson" id="txtcontactperson" class="in_testfield" style="width:516px" /></td>
                                  </tr>
                                  <tr>
                                    <td class="tdfirst"><?php echo $l_email;?>:</td>
                                    <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtmail" id="txtmail" class="in_testfield" style="width:516px" /><span style="font-size:11px; color:#424242; padding-left:10px">eg. http://www.elisoft.com, http://www.google.com</span></td>
                                  </tr>
								  <tr>
                                    <td class="tdfirst"><?php echo $l_Fax;?>:</td>
                                    <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtfax" id="txtfax" class="in_testfield" style="width:516px" /></td>
                                  </tr>
								  <tr>
                                    <td class="tdfirst"><?php echo $l_phone;?>:</td>
                                    <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtphone" id="txtphone" class="in_testfield" style="width:516px" /></td>
                                  </tr>
								  <tr>
                                    <td class="tdfirst"><?php echo $l_mobile;?>:</td>
                                    <td><input type="text" onkeypress="return enterTable(event,this.id);" name="txtmobile" id="txtmobile" class="in_testfield" style="width:516px" /></td>
                                  </tr>
								  <tr>
                                    <td class="tdfirst"><?php echo $l_description;?>:</td>
                                    <td><textarea name="txtdes" onkeypress="return enterTable(event,this.id);" id="txtdes" style="width:512px; height:50px" rows="4" cols="4"></textarea></td>
                                  </tr>
								 </table>
								<table bgcolor="#e8e8e8" width="100%" style="padding:20px 10px">
                                	<tr>
                                    	<td width="180"><?php echo $l_Activestatus;?></td>
                                        <td><input type="radio"  id="abc" name="abc" value="1" <?php if ($_REQUEST["abc"]=="1") echo "checked";?> /> <?php echo $l_yes;?> <input type="radio" name="abc" id="abc"  value="0" <?php if ($_REQUEST["abc"]=="0") echo "checked";?>/> <?php echo $l_No;?></td>
                                    </tr>
                                    <tr>
                                    	<td></td>
                                    	<td>
                                        	<div>
                                            	<input id="AddNew" onclick="addnew('<?=$_SESSION['thucthi']?>','<?php echo $_SESSION['checknamecus'];?>');" name="AddNew" style="margin-right:3px" type="button" value="<?php echo $l_add;?>" class="btnupbg btnupload" />
                                                <input id="Update" onclick="update('<?=$_SESSION['thucthi']?>','<?=$_SESSION['idcusupdel']?>','<?php echo $_SESSION['checknamecus'];?>');" name ="Update" style="margin-right:3px" type="button" value="<?php echo $l_update;?>" class="btnupbg btnupload" />
                                                <input id="Delete" onclick="deleteone('<?=$_SESSION['thucthi']?>','<?=$_REQUEST["abc"]?>','<?=$_SESSION['idcusupdel']?>');" name ="Delete" style="margin-right:3px" type="button" value="<?php echo $l_delete;?>" class="btnupbg btnupload" />
                                                <input id="ResetNew" name="ResetNew" type="button" value="<?php echo $l_reset;?>" class="btnupbg btnupload" onclick="resetvalue1(document.accsetupcus.list);"/>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
								</div>
								</div>
							</div>
						</div>
</form>